]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Fall back to app name in window caption
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 20 Feb 2018 17:29:00 +0000 (18:29 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Thu, 31 May 2018 11:27:44 +0000 (11:27 +0000)
Just like we did for the window list in app icons' context menu,
provide a fallback for window captions in the window picker rather
than showing blank items to the user.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/26

js/ui/workspace.js

index 1e121b7787ef697112a0c05844dba710ce20fd70..1ada50f8d588bc1abecc56ab172cafd74f98eddf 100644 (file)
@@ -447,12 +447,13 @@ var WindowOverlay = new Lang.Class({
         this.border = new St.Bin({ style_class: 'window-clone-border' });
 
         let title = new St.Label({ style_class: 'window-caption',
-                                   text: metaWindow.title });
+                                   text: this._getCaption() });
         title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
         windowClone.actor.label_actor = title;
 
         this._updateCaptionId = metaWindow.connect('notify::title', w => {
             this.title.text = w.title;
+            this.title.text = this._getCaption();
             this.relayout(false);
         });
 
@@ -565,6 +566,16 @@ var WindowOverlay = new Lang.Class({
         }
     },
 
+    _getCaption() {
+        let metaWindow = this._windowClone.metaWindow;
+        if (metaWindow.title)
+            return metaWindow.title;
+
+        let tracker = Shell.WindowTracker.get_default();
+        let app = tracker.get_window_app(metaWindow);
+        return app.get_name();
+    },
+
     _animateOverlayActor(actor, x, y, width, height) {
         let params = { x: x,
                        y: y,